package com.tanguy.driver.net.http

import cn.sinata.xldutils_kotlin.data.ResultData
import com.google.gson.JsonObject
import com.tanguy.driver.bean.GrabOrder
import com.tanguy.driver.bean.DriverPageBean
import com.tanguy.driver.bean.car.CarBrandBean
import com.tanguy.driver.bean.car.CarModelBean
import io.reactivex.Observable
import retrofit2.http.POST
import retrofit2.http.Query

/**
 *
 */
interface ApiService {
    //获取验证码
    @POST("app/smsrecord/getSms")
    fun sendSmsCode(@Query("phone") phone: String, @Query("type") type: Int): Observable<ResultData<Any>>

    //验证验证码
    @POST("app/smsrecord/yzCode")
    fun yzCode(@Query("phone") phone: String, @Query("type") type: Int, @Query("code") code: String): Observable<ResultData<Any>>

    //获取车辆品牌
    @POST("app/league/getBrandList")
    fun getBrandList(): Observable<ResultData<ArrayList<CarBrandBean>>>

    //获得车辆类型
    @POST("app/league/getModelList")
    fun getModelList(@Query("brandId") brandId: String): Observable<ResultData<ArrayList<CarModelBean>>>

    //司机注册
    @POST("app/driverInfo/regis")
    fun driverRegister(@Query("name") name: String
                       , @Query("sex") sex: Int
                       , @Query("idcard") idcard: String
                       , @Query("drivage") drivage: String
                       , @Query("licence") licence: String
                       , @Query("modelId") modelId: String
                       , @Query("color") color: String
                       , @Query("plate") plate: String
                       , @Query("careful") careful: String
                       , @Query("travel") travel: String
                       , @Query("insurance") insurance: String
                       , @Query("peoplecar") peoplecar: String
                       , @Query("phone") phone: String
                       , @Query("password") password: String
    ): Observable<ResultData<Any>>

    //获得车辆类型
    @POST("app/driverInfo/login")
    fun login(@Query("phone") phone: String, @Query("password") password: String): Observable<ResultData<JsonObject>>

    /**
     * 忘记密码
     */
    @POST("app/driverInfo/updatePasw")
    fun updatePasw(@Query("phone") phone: String, @Query("password") password: String): Observable<ResultData<Any>>

    /**
     * 获取司机主页
     */
    @POST("app/driverInfo/homepage")
    fun homepage(@Query("id") id: Int): Observable<ResultData<DriverPageBean>>

    /**
     * 下班
     */
    @POST("app/driverInfo/afterWork")
    fun afterWork(@Query("id") id: Int): Observable<ResultData<Any>>

    /**
     * 上班
     */
    @POST("app/driverInfo/goWork")
    fun goWork(@Query("id") id: Int): Observable<ResultData<Any>>

    /**
     * 司机抢单
     */
    @POST("app/grab/grabOrder")
    fun grabOrder(@Query("orderId") orderId: String, @Query("driverId") driverId: String, @Query("lat") lat: String, @Query("lon") lon: String): Observable<ResultData<GrabOrder>>
     /**
     * 司机参加排队
     */
    @POST("app/lineup/lineup")
    fun lineup(@Query("id") id: String, @Query("type") type: String, @Query("linid") linid: String, @Query("code") code: String, @Query("lat") lat: String, @Query("lon") lon: String): Observable<ResultData<JsonObject>>
    /**
     * 司机取消排队
     */
    @POST("app/lineup/cenlLineUp")
    fun cenlLineUp(@Query("id") id: String, @Query("type") type: String, @Query("linid") linid: String): Observable<ResultData<Any?>>

}